//#include "C2DHelpers.h"
#include "CGameEnv.h"

/*================
Begin Orthographic GL mode. Uses ortho_mv and pv
================
*/
void C2DHelpers::BeginOrtho()
{
    int vp[4];
    glPushAttrib(GL_ENABLE_BIT|GL_TEXTURE_BIT|GL_TRANSFORM_BIT);
    glGetIntegerv (GL_VIEWPORT,vp);
    glGetDoublev (GL_MODELVIEW_MATRIX, ortho_mv);
    glGetDoublev (GL_PROJECTION_MATRIX, ortho_pj);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0,vp[2],vp[3],0,-1,1);

    glDisable(GL_CULL_FACE);
    glDisable(GL_ALPHA_TEST);
    glDisable(GL_DEPTH_TEST);
}
/*
================
End Orthographic. Restores ortho_mv and ortho_pv
================
*/
void C2DHelpers::EndOrtho()
{
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixd(ortho_pj);
    glMatrixMode(GL_MODELVIEW);
    glLoadMatrixd(ortho_mv);
    glPopAttrib();
}



